<template>
  <div
    class="x-card"
    :style="{width: width,height: height}"
  >
    <div class="x-card_title">
      <div class="x-title_left">
        <div>
          <img src="../../../assets/点点点.png" />
        </div>
        <div>
          <p>{{ title }}</p>
          <p>{{ time }}</p>
        </div>
      </div>
      <div class="x-title_right">
        <el-popover
          placement="top"
          width="80"
          trigger="click"
        >
          <ul class="share">
            <li>
              <img src="../../../assets/weixin.png" />
              <span>微信</span>
            </li>
            <li>
              <img src="../../../assets/weibo.png" />
              <span>微博</span>
            </li>
            <li>
              <img src="../../../assets/haoyou.png" />
              <span>好友</span>
            </li>
          </ul>
          <i
            slot="reference"
            class="el-icon-share"
            @click="getShare"
          ></i>
        </el-popover>
        <i class="el-icon-download"></i>
        <i class="el-icon-setting"></i>
      </div>
    </div>
    <div class="x-card__body">
      <slot></slot>
    </div>
  </div>
</template>

<script>
export default {
  components: {},
  props: {
    // card宽度
    width: {
      type: String,
      default: () => {
        return '100%'
      }
    },
    // card高度
    height: {
      type: String,
      default: () => {
        return '100%'
      }
    },
    // 标题
    title: {
      type: String,
      default: () => {
        return '地图定位'
      }
    },
    time: {
      type: String,
      default: () => {
        return '2024年1月22号'
      }
    }
  },
  data () {
    return {
    }
  },
  computed: {},
  watch: {},
  created () { },
  mounted () {
  },
  methods: {
    getShare () {
      this.$emit('getShare')
    }
  },
}
</script>
<style lang='less' scoped>
.x-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 1px 1px 4px 1px #00000013;
  .x-card_title {
    padding: 10px 8px;
    box-sizing: border-box;
    border-bottom: 1px solid #e9e9e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .x-title_left {
      display: flex;
      align-items: center;
      > div:nth-child(1) {
        margin-right: 6px;
        img {
          width: 14px;
        }
      }
      > div:nth-child(2) {
        p:nth-child(1) {
          color: #293231;
          font-weight: bold;
          font-family: "黑体";
          margin-bottom: 4px;
        }
        p:nth-child(2) {
          color: #9bb2ae;
          font-family: "黑体";
          font-size: 12px;
          font-weight: 500;
        }
      }
    }
    .x-title_right {
      width: 40%;
      display: flex;
      justify-content: right;
      i {
        font-weight: bold;
        margin: 0 4px;
        cursor: pointer;
      }
    }
  }
  .x-card__body {
    height: calc(100% - 57px);
    padding: 8px;
    box-sizing: border-box;
  }
}
.share {
  li {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 6px 16px;
    box-sizing: border-box;
    cursor: pointer;
    img {
      width: 20px;
      margin-right: 16px;
    }
    span {
      font-size: 16px;
      font-weight: 500;
    }
  }
  li:hover {
    background: #f2f2f2;
  }
  li:last-child {
    margin-bottom: 0;
  }
}
</style>